﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class TransformExtension
{
    public static IEnumerable<T> GetChilds<T>(this Transform transform)
    {
        foreach (Transform item in transform)
        {
            yield return item.GetComponent<T>();
        }
    }

    public static IEnumerable GetChilds(this Transform transform)
    {
        foreach (Transform item in transform)
        {
            yield return item;
        }
    }
}
